<!doctype html>
<!--
	作者：吴忠键
	时间：2018-04-20
	描述：错题回顾页面
-->
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/answer.css" rel="stylesheet" />
	</head>

	<body onload="errorViewGo()">
		<script src="js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
		</script>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title" style="color: red;">错题回顾</h1>
		</header>
		<!--
        	作者：吴忠键
        	时间：2018-04-20
        	描述：错题回顾
        -->
		<div class="answer-question answer-background-color">
			<div class="error-view-choise" align="center">
				<img src="images/repair.png"/>
			</div>
			<div id="answer-error-question">
				<div class="mui-content">
					<ul id="ul-error-testPage" class="mui-table-view mui-table-view-chevron">
					
					</ul>
				</div>
				
			</div>
			
				<!--
        	作者：offline
        	时间：2018-04-25
        	描述：引入自己定义的IP地址
        -->
			<script src="js/ip.js"></script>
			
			<!--
            	作者：offline
            	时间：2018-04-30
            	描述：编写当用户选择查看自己的历史错题
            	根据用户自身的ID查询出自己的错题库，错题的试卷号显示
            -->
            
			<script>
				function errorViewGo(){
					var errorViewHttpUrl = IP+'seleteUserErrorQid';
					/*
					 * 根据用户ID查询用户的错题，在根据错题的QID确定错题属于哪个试卷，
					 * 得到试卷号，渲染到页面。
					 * 还可以选择时间范围
					 */									
					mui.ajax(errorViewHttpUrl,{
						type:"post",  
						data:{
							uId:1,
						},
						success:function(data){
							console.log(data.userErrorTpIdList);
							console.log(data.userErrorTpNameList);
							var errorHtml = "";
							for(var i = 0;i<data.userErrorTpNameList.length;i++){
								errorHtml = '<li class="mui-table-view-cell">';
								errorHtml += '<a onclick="transmitTpid(this)" data-title-type="native" style="padding-left: 40px;"><span class="hide">'+data.userErrorTpIdList[i]+'</span>';
								errorHtml += '<span style="font-size:18px;">'+data.userErrorTpNameList[i]+'</span><div class="error-view-page-choise">';
								errorHtml += '<img style="" src="images/error-finger.png"/>';
								errorHtml += '</div></a></li>';
								document.getElementById("ul-error-testPage").innerHTML += errorHtml;
							}
						}
					});
					
				};
				
				/*
				 * 选择查看试卷的点击事件，传递tpid以及跳转页面
				 */
				function transmitTpid(obj){
					console.log(obj.firstChild.innerText);
					console.log(obj.firstChild.nextSibling.innerText);
					var tpId = localStorage.setItem('tpId',obj.firstChild.innerText);
					var tpName = localStorage.setItem('tpName',obj.firstChild.nextSibling.innerText);
					mui.openWindow({
					    url:'error_question_view.html',
					    id:'error_question_view.html',
					});
				}
			</script>
		</div>
		<nav class="mui-bar mui-bar-tab">
			<a class="mui-tab-item mui-active" href="#index">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item" href="#tabbar-with-chat">
				<span class="mui-icon mui-icon-email"><span class="mui-badge">9</span></span>
				<span class="mui-tab-label">消息</span>
			</a>
			<a class="mui-tab-item" href="#tabbar-with-contact">
				<span class="mui-icon mui-icon-help"></span>
				<span class="mui-tab-label">关于我们</span>
			</a>
			<a class="mui-tab-item" href="#tabbar-with-map">
				<span class="mui-icon mui-icon-contact"></span>
				<span class="mui-tab-label">我的</span>
			</a>
		</nav>
	</body>

</html>